
using System;
using System.Text;
using System.Collections.Generic;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Microsoft.Services.TfsAlert.Core;
using Microsoft.Services.TfsAlert.AppCode;
using Microsoft.Services.TfsAlert.AppCode.NotificationEvents;

namespace Microsoft.Services.TfsAlert.AppCode
{

    [TestClass]
    public class SubscriptionInfo_UnitTests
    {
        [TestMethod]
        public void SerializeSubscriptionInfo()
        {
            SubscriptionInfo subscriptionInfo = new SubscriptionInfo();
            subscriptionInfo.ID = 1234;
            subscriptionInfo.Subscriber = "ASDF";
            subscriptionInfo.Classification = "ASDF1234";
            
            ApplicationHelpers applicationHelpers = new ApplicationHelpers();
            
            string result = applicationHelpers.SerializeXml<SubscriptionInfo>(subscriptionInfo);

            Assert.IsNotNull(result);
        }

        [TestMethod]
        public void DeSerializeSubscriptionInfo()
        {
            const string testInput =
                @"<?xml version=""1.0""?><SubscriptionInfo xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema""><Classification>ASDF1234</Classification><Subscriber>ASDF</Subscriber><ID>1234</ID></SubscriptionInfo>";

            ApplicationHelpers applicationHelpers = new ApplicationHelpers();

            SubscriptionInfo result = applicationHelpers.DeserializeXml<SubscriptionInfo>(testInput);

            Assert.IsNotNull(result); 
        }
    }
}
